using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class UI_Popup_Base :  MonoBehaviour
{
    public static List<string> queuePopups = new List<string>();

    public abstract string popupName { get; }

    public abstract void Init(params object[] objects);
    public virtual void OnExit()
    {
        if (isSingleton)
        {
            gameObject.SetActive(false);
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
    public abstract bool isSingleton { get; }

    protected  void OnEnable()
    {
        queuePopups.Add(this.name);

    }
    protected void OnDisable()
    {
        queuePopups.Remove(this.name);
    }

}
public abstract class UI_Popup_Base<T> : UI_Popup_Base where T : UI_Popup_Base<T>, new()
{
    public static T main;
    public override bool isSingleton => true;
    protected virtual void Start()
    {
        main = (T)this;
    }
    protected virtual void OnDestroy()
    {
        main = null;
    }
}
